<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			//获取日期所在月份天数
			Date.prototype.getDays = function() {
				var d1 = new Date(this);
				var d2 = new Date(this);
				d1.setMonth(this.getMonth() + 1);
				d1.setDate(1);
				d2.setDate(1);
				return (d1 - d2) / (1000 * 60 * 60 * 24);
			}
			var dd = new Date();
			console.log(dd.getFullYear());
			console.log(dd.getMonth() + 1)
			console.log(dd.getDate())
			console.log(dd.getDays())
		</script>
	</body>

</html>